package GuavaTest;

import com.google.common.base.Optional;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Created by wangyg 
 * on 2017/6/12 10:36
 */
public class LikeMap<T> {

	public T or(T defaultValue) {
		return checkNotNull(defaultValue, "use Optional.orNull() instead of Optional.or(null)");
	}

	@SuppressWarnings("unchecked") // safe covariant cast
	public LikeMap<T> or(LikeMap<? extends T> secondChoice) {
		return (LikeMap<T>) checkNotNull(secondChoice);
	}
}
